
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>对账系统</title>
<meta name="Copyright" content="Douco Design." />
<link href="css/public.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/global.js"></script>
<script language="javascript" type="text/javascript"
	src="js/My97DatePicker/WdatePicker.js"></script>
<script language="javascript" src="js/LodopFuncs.js"></script>
<object id="LODOP_OB"
	classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width=0 height=0>
	<embed id="LODOP_EM" TYPE="application/x-print-lodop" width=0 height=0
		PLUGINSPAGE="install_lodop.exe"></embed>
</object>
<style type="text/css">
p {
	margin: 0
}

#page {
	height: 40px;
	padding: 20px 0px;
}

#page a {
	display: block;
	float: left;
	margin-right: 10px;
	padding: 2px 12px;
	height: 24px;
	border: 1px #cccccc solid;
	background: #fff;
	text-decoration: none;
	color: #808080;
	font-size: 12px;
	line-height: 24px;
}

#page a:hover {
	color: #077ee3;
	border: 1px #077ee3 solid;
}

#page a.cur {
	border: none;
	background: #077ee3;
	color: #fff;
}

#page p {
	float: left;
	padding: 2px 12px;
	font-size: 12px;
	height: 24px;
	line-height: 24px;
	color: #bbb;
	border: 1px #ccc solid;
	background: #fcfcfc;
	margin-right: 8px;
}

#page p.pageRemark {
	border-style: none;
	background: none;
	margin-right: 0px;
	padding: 4px 0px;
	color: #666;
}

#page p.pageRemark b {
	color: red;
}

#page p.pageEllipsis {
	border-style: none;
	background: none;
	padding: 4px 0px;
	color: #808080;
}

.dates li {
	font-size: 14px;
	margin: 20px 0
}

.dates li span {
	float: right
}
</style>
 <?php
	include ("function.php");
	include ('page.class.php'); // 分页类
	                           // error_reporting(0);
	mssql_select_db ( $mssql_database, $conn );
	global $s;
	global $e;
	global $p;
	$s = $_COOKIE ["s"];
	$e = $_COOKIE ["e"];
	$p = $_COOKIE ["p"];
	$showrow = 100; // 一页显示的行数
	$curpage = empty ( $_GET ['page'] ) ? 1 : $_GET ['page']; // 当前的页,还应该处理非数字的情况
	$url = "?page={page}"; // 分页地址，如果有检索条件 ="?page={page}&q=".$_GET['q']
	                       // 省略了链接mysql的代码，测试时自行添加
	$sql = "SELECT * from dzxt where Date between '$s' and '$e' and etypeid='$p'";
	$limit = ($curpage - 1) * $showrow;
	$total = mssql_num_rows ( mssql_query ( $sql ) ); // 记录总条数
	if (! empty ( $_GET ['page'] ) && $total != 0 && $curpage > ceil ( $total / $showrow ))
		$curpage = ceil ( $total_rows / $showrow ); // 当前页数大于最后页数，取最后一页
			                                         // 获取数据
	$sql2 = "with fy
as(
select top $showrow Vchcode from dzxt  AS B where B.batch=0 and B.Date between '$s' and '$e' and B.Vchcode not in(select top $limit Vchcode from dzxt where Date between '$s' and '$e' and etypeid='$p' )
)
select *  from dzxt where Vchcode in (select * from fy) order by Number
";
	// $sql2="select * from dzxt where etypeid='$p' and Date between '$s' and '$e' ";
	$sq = iconv ( "utf-8", 'gb2312', "$sql2" );
	$query = mssql_query ( $sq );
	$i = 1;
	?>
</head>
<body>
	<div id="dcWrap">
		<div id="dcHead">
			<div id="head">
				<div class="logo">
					<a href="index.php"><img src="images/logo.png" alt="logo"></a>
				</div>
				<div class="nav">
					<ul>
						<li class="noRight"><a href="index.php">业务草稿销售单&经营历程销售单</a></li>
					</ul>
				</div>
			</div>
		</div>
		<!-- dcHead 结束 -->
		<div id="dcLeft">
			<div id="menu">
				<ul class="top">
					<li class="cur"><a href="index.php"><i class="home"></i><em>单据分配</em></a></li>
				</ul>
				<ul>
					<li><a href="jz.php"><i class="managerLog"></i><em>交账处理</em></a></li>
					<li><a href="exchange.php"><i class="backup"></i><em>送货更换</em></a></li>
					<li><a href="init.php"><i class="system"></i><em>报错点这里</em></a></li>
				</ul>
			</div>
		</div>
		<div id="dcMain">
			<!-- 当前位置 -->
			<div id="urHere">单据管理中心</div>
			<div id="index" class="mainBox"
				style="padding-top: 18px; height: auto !important; height: 550px; min-height: 550px;">


				<div id="douApi"></div>
				<div class="indexBox">
					<div class="boxTitle">送货人分配</div>

				</div>
				<div class="filter">
					<p>①单击送货人，选择对应单据送货人点确定</p>
					<p>②单击批次，填写该送货人第几批送货</p>
				</div>
				<div class="filter">
					<form action="dlyndx.php" method="post">
						<input name="start" value="<?php echo $s;?>" type="text"
							class="inpMain" onClick="WdatePicker()" /> ~ <input name="end"
							value="<?php echo $e;?>" type="text" class="inpMain"
							onClick="WdatePicker()" /> <input name="submit" class="btnGray"
							type="submit" value="统计" />
					</form>
				</div>
				<div id="list" class="demo">
					<div id='div1'>
						<table width="100%" border="0" cellpadding="8" cellspacing="0"
							class="tableBasic">
							<tr>
								<th width="5" align="center">行号</th>
								<th width="5" align="center">批次</th>
								<th width="30" align="center">送货人</th>
								<th width="40" align="center">单据编号</th>
								<th width="40" align="center">往来单位</th>
								<th width="150" align="center">摘要</th>
								<th width="20" align="center">应收（元）</th>

							</tr>
    
                   <?php
																			while ( $rst = mssql_fetch_assoc ( $query ) ) {
																				?>
                   <tr>
								<td align="center"><?php echo $i;$i++;?></td>
								<td align="center" type="number" class="editbatch"
									id="<?php echo iconv ( 'gbk', 'utf-8', $rst ['Vchcode']); ?>"><?php echo round(iconv ( 'gbk', 'utf-8', $rst ['batch']),2); ?></td>
								<td align="center" class="edit_select"
									id="<?php echo iconv ( 'gbk', 'utf-8', $rst ['Vchcode']); ?>"><?php
																				global $shr;
																				$shr = iconv ( 'gbk', 'utf-8', $rst [efullname] );
																				echo $shr;
																				
																				?></td>
								<td align="center"><?php echo $rst ['Number'];?></td>
								<td align="center"><?php
																				
echo iconv ( 'gbk', 'utf-8', $rst ['bfullname'] );
																				?></td>
								<td align="center"><?php echo iconv ( 'gbk', 'utf-8', $rst ['summary']); ?></td>
								<td align="center" type="number"><?php echo round(iconv ( 'gbk', 'utf-8', $rst ['Total']),2); ?></td>

							</tr>
                   
                     <?php
																			}
																			
																			?>
																			
          
   
      
      </table>
					</div>

				</div>
				<div class="showPage"> <?php
				if ($total > $showrow) { // 总记录数大于每页显示数，显示分页
					$page = new page ( $total, $showrow, $curpage, $url, 2 );
					echo $page->myde_write ();
				}
				?>          </div>
				<div class="clear"></div>

			</div>
			<div class="clear"></div>
			<div id="dcFooter">
				<div id="footer">
					<div class="line"></div>

					<ul>版权所有 © 2015-2018 jsycydym@qq.com，并保留所有权利。
					</ul>
				</div>
			</div>
			<!-- dcFooter 结束 -->
			<div class="clear"></div>
		</div>
		<script type="text/javascript"
			src="http://www.sucaihuo.com/Public/js/other/jquery.js"></script>
		<script type="text/javascript" src="js/jquery.jeditable.min.js"></script>
		<script type='text/javascript' src='js/jquery-ui.min.js'></script>
		<script type="text/javascript">
            $(function() {
                $('.edit').editable('ajax.php', {
                    width: 20,
                    height: 18,
                    //onblur    : "ignore",
                    indicator: '<img src="images/loader.gif">',
                    tooltip: '单击填写...',
                    callback: function(value, settings) {
                        $("#modifiedtime").html("刚刚");
                    }
                });
                     $('.edityh').editable('ajaxyh.php', {
                    width: 20,
                    height: 18,
                    //onblur    : "ignore",
                    indicator: '<img src="images/loader.gif">',
                    tooltip: '单击填写...',
                    callback: function(value, settings) {
                        $("#modifiedtime").html("刚刚");
                    }
                });
                     $('.editbatch').editable('ajaxb.php', {
                         width: 20,
                         height: 18,
                         //onblur    : "ignore",
                         indicator: '<img src="images/loader.gif">',
                         tooltip: '单击填写...',
                         callback: function(value, settings) {
                             $("#modifiedtime").html("刚刚");
                         }
                     });
                $('.edit_select').editable('ajaxe.php', {
                    loadurl: 'json.php',
                    type: "select",
                    cancel: '取消',
                    submit: '确定',
                    indicator: '<img src="images/loader.gif">',
                    tooltip: '单击选择.',
                    style: 'display: inline'
                });
                $(".datepicker").editable('ajax.php', {
                    width: 120,
                    type: 'datepicker',
                    onblur: "ignore",
                    indicator: '<img src="images/loader.gif">',
                    tooltip: '单击填写...',
                    style: 'display: inline'
                });
                $(".textarea").editable('ajax.php', {
                    type: 'textarea',
                    rows: 6,
                    cols: 50,
                    onblur: "ignore",
                    indicator: '<img src="images/loader.gif">'
                });
            });      
        </script>

</body>
</html>